package sk.stuba.fiit.repka.dp.owl.gui;

import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import sk.stuba.fiit.repka.dp.owl.MyOWLClass;
import sk.stuba.fiit.repka.dp.owl.MyOWLDataProperty;
import sk.stuba.fiit.repka.dp.owl.MyOWLIndividual;
import sk.stuba.fiit.repka.dp.owl.MyOWLObjectProperty;
import sk.stuba.fiit.repka.dp.gui.MainWindow;
import sk.stuba.fiit.repka.dp.integration.IntegrationInputPanel;
import sk.stuba.fiit.repka.dp.wsdlconverter.WSDL2OWLSConverterPanel;
import sk.stuba.fiit.repka.dp.integration.IntegrationResultPanel;
import sk.stuba.fiit.repka.dp.rating.gui.RatingPanel;

public class MainPanel extends JPanel {
	
	private List<MyOWLClass> owlClassesList;
	private List<MyOWLObjectProperty> objectPropertyList;
	private List<MyOWLDataProperty> dataPropertyList;
	private List<MyOWLIndividual> individualsList;
	private List<String> usedRecommendations; //recommendations which were used by user
	
	public List<MyOWLClass> getOwlClassesList() {
		if(this.owlClassesList == null) {
			this.owlClassesList = new ArrayList<MyOWLClass>();
		}
		return this.owlClassesList;
	}
	
	public List<MyOWLObjectProperty> getObjectPropertyList() {
		if(this.objectPropertyList == null) {
			this.objectPropertyList = new ArrayList<MyOWLObjectProperty>();
		}
		return this.objectPropertyList;
	}
	
	public List<MyOWLDataProperty> getDataPropertyList() {
		if(this.dataPropertyList == null) {
			this.dataPropertyList = new ArrayList<MyOWLDataProperty>();
		}
		return this.dataPropertyList;
	}
	
	public List<MyOWLIndividual> getIndividualsList() {
		if(this.individualsList == null) {
			this.individualsList = new ArrayList<MyOWLIndividual>();
		}
		return this.individualsList;
	}
	
	public List<String> getUsedRecommendations() {
		if(this.usedRecommendations == null) {
			this.usedRecommendations = new ArrayList<String>();
		}
		return this.usedRecommendations;
	}
	
	private MainWindow mainWindow;
	
	public MainWindow getMainWindow() {
		return this.mainWindow;
	}
	
	/**
	 * Create the panel.
	 */
	public MainPanel(MainWindow parent) {
		this.mainWindow = parent;
		//TODO testing
//		OWLClass bla = new OWLClass("bla");
//		OWLClass hos = new OWLClass("Hospital", bla);
//		OWLClass loc = new OWLClass("Location", hos);
//		OWLClass air = new OWLClass("Airport");
//		OWLClass test = new OWLClass("Test");
//		OWLClass test2 = new OWLClass("Test2");
//		OWLClass test3 = new OWLClass("test3");
//		OWLClass test4 = new OWLClass("Test");
//		OWLClass test5 = new OWLClass("Test2");
//		OWLClass test6 = new OWLClass("test6");
//		OWLClass test7 = new OWLClass("Test7");
//		OWLClass test8 = new OWLClass("Test8");
//		OWLClass test9 = new OWLClass("test9");
//		OWLClass test0 = new OWLClass("Test0");
//		OWLClass test11 = new OWLClass("Test11");
//		OWLClass test12 = new OWLClass("test12");
//		OWLClass a1 = new OWLClass("aaaaaaaaaaa");
//		OWLClass a2 = new OWLClass("bbbbbbbbbbbbbbb");
//		OWLClass a3 = new OWLClass("cccccccc");
//		OWLClass a4 = new OWLClass("ddddddddd");
//		OWLClass a5 = new OWLClass("eeeeeeee");
//		OWLClass a6 = new OWLClass("ffffffffff");
//		OWLClass a7 = new OWLClass("ggggggggg");
//		this.getOwlClassesList().add(loc);
//		this.getOwlClassesList().add(air);
//		this.getOwlClassesList().add(test);
//		this.getOwlClassesList().add(test2);
//		this.getOwlClassesList().add(test3);
//		this.getOwlClassesList().add(test4);
//		this.getOwlClassesList().add(test5);
//		this.getOwlClassesList().add(test6);
//		this.getOwlClassesList().add(test7);
//		this.getOwlClassesList().add(test8);
//		this.getOwlClassesList().add(test9);
//		this.getOwlClassesList().add(test0);
//		this.getOwlClassesList().add(test11);
//		this.getOwlClassesList().add(test12);
//		this.getOwlClassesList().add(a1);
//		this.getOwlClassesList().add(a2);
//		this.getOwlClassesList().add(a3);
//		this.getOwlClassesList().add(a4);
//		this.getOwlClassesList().add(a5);
//		this.getOwlClassesList().add(a6);
//		this.getOwlClassesList().add(a7);
		//end
		//TODO test individuals
		this.getIndividualsList().add(new MyOWLIndividual("name", new MyOWLClass("class")));
		this.getIndividualsList().add(new MyOWLIndividual("name2", new MyOWLClass("class2")));
		//end
		
		setLayout(new GridLayout(0, 1, 0, 0));
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		add(tabbedPane);
		
		InitialOWLPanel initialOWLPanel = new InitialOWLPanel(this);
		tabbedPane.addTab("Initial Ontology", null, initialOWLPanel, null);
		
//		ClazzPanel clazzPanel = new ClazzPanel(this);
//		tabbedPane.addTab("Class", null, clazzPanel, null);
//		
//		DataPropPanel dataPropPanel = new DataPropPanel(this);
//		tabbedPane.addTab("Data Properties", null, dataPropPanel, null);
//		
//		ObjectPropPanel objectPropPanel = new ObjectPropPanel(this);
//		tabbedPane.addTab("Object Properties", null, objectPropPanel, null);
//		
//		IndividualPanel individualPanel = new IndividualPanel(this);
//		tabbedPane.addTab("Individuals", null, individualPanel, null);
		
		WSDL2OWLSConverterPanel l2OWLSConverterPanel = new WSDL2OWLSConverterPanel();
		tabbedPane.addTab("WSDL2OWLS", null, l2OWLSConverterPanel, null);
		
		IntegrationInputPanel integrationPanel = new IntegrationInputPanel();
		tabbedPane.addTab("Send to composer", null, integrationPanel, null);
		
		IntegrationResultPanel integrationResultPanel = new IntegrationResultPanel();
		tabbedPane.addTab("Result", null, integrationResultPanel, null);
		
		integrationPanel.objPDDXML_Load(integrationResultPanel);
		
		RatingPanel ratingPanel = new RatingPanel(this);
		tabbedPane.addTab("Rating", null, ratingPanel, null);

	}
}
